package routers

import (
	"github.com/gin-gonic/gin"
	"local/controllers"
	"local/middlewares"
)

/**
 * 路由
 */
func SetupRouters() (r *gin.Engine) {

	r = gin.Default()

	//静态资源文件夹
	r.Static("/static", "static")

	//用户类路由
	user := r.Group("/User")
	//加入登录验证中间件
	user.Use(middlewares.LoginMiddleWare)
	{
		//增删改查

		user.GET("/SelectUserById", controllers.SelectUserById)
		user.POST("/SelectUserById", controllers.SelectUserById)

		user.GET("/UpdateUserById", controllers.UpdateUserById)
		user.POST("/UpdateUserById", controllers.UpdateUserById)

		user.GET("/DeleteUserById", controllers.DeleteUserById)
		user.POST("/DeleteUserById", controllers.DeleteUserById)

		user.GET("/InsertUser", controllers.InsertUser)
		user.POST("/InsertUser", controllers.InsertUser)
	}

	return
}
